public class Date {
    public int year;
    public int month;
    public int day;

    Date(){
//        this.year = 2003;
//        this.month = 7;
//        this.day = 17;
        this(2003,7,17);
        //调用另一个带有三个参数的构造方法
        System.out.println("不带参数的构造方法！");
    }
//    Date(int year,int month,int day){
//        this.year = year;
//        this.month = month;
//        this.day = day;
//    }


    public Date(int year, int month, int day) {
        this.year = year;
        this.month = month;
        this.day = day;
    }

    public Date(int year, int month) {
        this.year = year;
        this.month = month;
    }

    public void SetDate(int year, int month, int day){
        this.year = year;
        this.month = month;
        this.day = day;
        //this:代表当前对象的引用
        this.printDate();
    }


    public void printDate(){
        System.out.println(this.year+" "+this.month+" "+this.day);
    }

    public static void main(String[] args) {
        Date date = new Date();
        date.SetDate(2022,7,10);
        Date date1 = new Date();
        date.printDate();
        date1.SetDate(2021,7,10);
        Date date2 = new Date();
        date1.printDate();
        date2.SetDate(2022,7,10);
        date2.printDate();
        Date date3 = new Date(2004,7,17);
    }
}
